﻿#ifndef _OI_PLSCANNER_PRODUCTPRESET_HPP_
#define _OI_PLSCANNER_PRODUCTPRESET_HPP_

#include "Appl/OiAppl.hpp"

namespace Oi { namespace PLScannerCore {

class OI_PLSCANNER_CORE_API PresetToolParams
{
public:
    int toolType;
    QVariantMap config;

public:
    PresetToolParams()
    {
        toolType = 0;
    }

    PresetToolParams(const PresetToolParams& p)
    {
        *this = p;
    }

    PresetToolParams& operator=(const PresetToolParams& p)
    {
        toolType = p.toolType;
        config = p.config;
        return *this;
    }
};

typedef QMap<QString, PresetToolParams> PresetParams;

class OI_PLSCANNER_CORE_API PresetParamsManager
{

public:
    PresetParamsManager();

public:
    bool isValid();

    void loadParams();

    void saveParams();

    bool addParams(const QString& name, const PresetParams &);

    bool delParams(const QString& name);

    bool setParams(const QString& name, const PresetParams &);

public:
    QStringList presetNames() const;
    PresetParams& params(QString name);
    QMap<QString, PresetParams>& paramsMap();

public:
    static PresetParamsManager* instance();

private:
    OI_DISABLE_COPY(PresetParamsManager);
    OI_DECLARE_IMPL(PresetParamsManager);

};


} }

#endif
